<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <script>
                let map = new Map(
                    [
                        ["name","张三"],//键值对1
                        ["age","18"],//键值对2
                        [[1,2],"这是一个键名为数组的键值对"]//键值对3
                    ]
                );
                //每个键值对的数组中  第0项是键名 第1项是键值
                console.log(map);
                console.log(map.size);
                
                //set
                map.set("name","李四");//如果传入的键名之前存在 就修改该键名对应的键值
                console.log(map);
        
                map.set("gender","男");//如果传入的键名之前不存在 就添加键值对
                console.log(map);
        
                //get
                console.log(map.get("name"));
                //has
                console.log(map.has("name"));//true
                console.log(map.has("skill"));//false
        
                //delete
                map.delete("name");
                console.log(map);
        
                //clear
                map.clear();
                console.log(map);
        
            </script>
</body>
</html>